﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Data;

namespace ORMAC.Core
{
    internal class XmlLoader : LoaderBase
    {

        internal List<T> GetList<T>(string xmlPathName)
          where T : new()
        {
            dataSet = new DataSet();
            dataSet.ReadXml(xmlPathName);
            return GetList<T>(dataSet, string.Empty);

        }

        internal List<T> GetList<T>(XmlDocument doc)
            where T : new()
        {
            dataSet = new DataSet();
            using (XmlNodeReader xnr = new XmlNodeReader(doc)) 
            { 
                dataSet.ReadXml(xnr);
                return GetList<T>(dataSet, string.Empty);
            } 
        }
    }
}
